﻿using System.Collections.Generic;
using System.Linq;
using LINQtoFxCop.Core;

namespace LINQtoFxCop.Flaws.Design
{
  internal sealed class DesignAbstractTypesShouldNotHavePublicConstructors : FlawsIntrospectionRule
  {
    public DesignAbstractTypesShouldNotHavePublicConstructors()
      : base("DesignAbstractTypesShouldNotHavePublicConstructors")
    { }

    protected override IEnumerable<QueryResult> Query()
    {
      return
        from type in Types
        where type.IsAbstract && type.HasPublicConstructor()
        select Result(type);
    }
  }
}